package dk.android.houseenabler;


import android.app.TabActivity;
import android.content.Intent;
import android.content.res.Resources;
import android.os.Bundle;
import android.widget.TabHost;

public class TabsActivity extends TabActivity {

	
	/** Called when the activity is first created. */
		@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.tabs);
		
		Intent prevIntent = getIntent();
		Resources res = getResources();
		TabHost tabHost = getTabHost();
		TabHost.TabSpec spec;
		Intent intent;
		
		String title = prevIntent.getStringExtra("house");
		int position = prevIntent.getIntExtra("position", -1);
		setTitle(title);
		

		intent = new Intent().setClass(this, ExpandableActivity.class);
		
		intent.putExtra("category", "a");
		intent.putExtra("houseTitle",title);
		intent.putExtra("housePosition", position);

		spec = tabHost.newTabSpec("a")
				.setIndicator("A", res.getDrawable(R.drawable.ic_tab_a))
				.setContent(intent);
		tabHost.addTab(spec);
		intent = new Intent().setClass(this, ExpandableActivity.class);
		

		intent.putExtra("category", "b");
		intent.putExtra("houseTitle",title);
		intent.putExtra("housePosition", position);
		
		spec = tabHost
				.newTabSpec("b")
				.setIndicator("B",
						res.getDrawable(R.drawable.ic_tab_b))
				.setContent(intent);

		tabHost.addTab(spec);

		
		intent = new Intent().setClass(this, ExpandableActivity.class);
	
		intent.putExtra("category", "c");
		intent.putExtra("houseTitle",title);
		intent.putExtra("housePosition", position);
		
		spec = tabHost
				.newTabSpec("c")
				.setIndicator("C",
						res.getDrawable(R.drawable.ic_tab_c))
				.setContent(intent);

		tabHost.addTab(spec);
		
		intent = new Intent().setClass(this, ExpandableActivity.class);
	
		intent.putExtra("category", "d");
		intent.putExtra("houseTitle",title);
		intent.putExtra("housePosition", position);
		
		spec = tabHost
				.newTabSpec("d")
				.setIndicator("D",
						res.getDrawable(R.drawable.ic_tab_d))
				.setContent(intent);

		tabHost.addTab(spec);
		
		tabHost.setCurrentTab(0);
	}

	
}